<template>
    <div class="mod-home">
            <table-grid
                ref="mbTableRef"
                style="height: 100%;"
                :button-list="buttonList"
                tableTitle="客户目标"
                :tableColumn="mbTableColumn"
                :tableData="mbTableData"
                @btnClick="mbBtnClick"
            >
            </table-grid>
        <department ref="departmentRef"></department>
    </div>
</template>

<script>
import department from '@/views/modules/manage/plan/department.vue'
export default {
    components: {
        department
    },
    data () {
        return {
            buttonList: [
                {name: "保存",code: "save",type: "success"},
                {name: "新增",code: "add",type: "primary"},
                {name: "删除",code: "delete",type: "danger"},
            ],
            mbTableData: [
                {
                    type: "目标类型01",
                    person: "张三",
                    createDate: "2025-02-28",
                    startDate: "2025-02-28",
                    endDate: "2025-03-28",
                },
                {
                    type: "目标类型02",
                    person: "张三",
                    createDate: "2025-02-28",
                    startDate: "2025-02-28",
                    endDate: "2025-03-28",
                }
            ],
            mbTableColumn: [
                {type: 'seq', width: 60},
                {type: 'checkbox',  width: 50},
                {field: 'cuscode',  title: '客户代码'},
                {field: 'cusname',  title: '客户名称'},
                {field: 'prodcode', title: '本期合同额',editRender: {name: 'VxeInput', props: { type: "number", clearable: true }}},
                {field: 'proddesc', title: '本期发货额',editRender: {name: 'VxeInput', props: { type: "number", clearable: true }}},
                {field: 'prodsale', title: '沟通次数',editRender: {name: 'VxeInput', props: { type: "number", clearable: true }}},
                {field: 'prodamt',  title: '最近沟通日期',editRender: {name: 'VxeInput', props: { type: "number", clearable: true }}}
            ],
            khTableData: [
                {
                    code: "person001",
                    name: "客户名称001",
                    xs: 2000,
                    hk: 2000,
                    fy: 2000,
                },
                {
                    code: "person002",
                    name: "客户名称002",
                    xs: 2000,
                    hk: 2000,
                    fy: 2000,
                },
            ]
        }
    },
    mounted () {

    },
    methods: {
        oprClick(){
            this.$refs.departmentRef.init()
        },
        mbBtnClick(btn){
            switch (btn.code) {
                case "add":
                    this.$refs.mbTableRef.insert();
            }
        },
        khBtnClick(btn){
            switch (btn.code) {
                case "add":
                    this.$refs.khTableRef.insert();
            }
        },
    }
}
</script>

<style lang="scss" scoped>
.mod-home{
    display: flex;
    justify-content: space-between;
    background-color: #f1f1f1;
}
.fenge{
    width: 5px;
    background-color: #f1f1f1;
    height: 100%;
}
.left{

}

</style>
